package com.crm.system.service.impl.customerManager;

import com.crm.common.model.DhPageInfo;
import com.crm.model.qo.contractManager.ContractRawDataQO;
import com.crm.model.qo.customerManager.MemberCardRawDataQO;
import com.crm.model.vo.customerContractManager.ContractRawDataVO;
import com.crm.model.vo.customerManager.MemberCardRawDataVO;
import com.crm.service.contractManager.ContractRawDataDbService;
import com.crm.service.customerManager.MemberCardRawDataDbService;
import com.crm.system.service.contractManager.ContractRawDataService;
import com.crm.system.service.customerManager.MemberCardRawDataService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @ Author ：pym
 * @ Date   ：2021/7/23 14:48
 */
@Service
public class MemberCardRawDataServiceImpl implements MemberCardRawDataService {
    @Autowired
    private MemberCardRawDataDbService memberCardRawDataDbService;

    /**
     * 会员卡原始数据
     * @param pageIndex -页码
     * @param pageSize -分页大小
     * @param sortName -排序列名字
     * @param sortOrder -排序规则(asc/desc)
     * @param memberCardRawDataQO 查询条件
     * @return
     */
    @Override
    public DhPageInfo<MemberCardRawDataVO> memberCardRawDataList(Integer pageIndex, Integer pageSize, String sortName, String sortOrder, MemberCardRawDataQO memberCardRawDataQO) {
        List<MemberCardRawDataVO> contractRawDataList = new ArrayList<MemberCardRawDataVO>();
        if (pageIndex != null && pageSize != null) {
            PageHelper.startPage(pageIndex, pageSize);
        }
        contractRawDataList = memberCardRawDataDbService.memberCardRawDataList(memberCardRawDataQO);
        PageInfo<MemberCardRawDataVO> pageInfo = new PageInfo<MemberCardRawDataVO>(contractRawDataList);
        return new DhPageInfo<MemberCardRawDataVO>(pageInfo, contractRawDataList);
    }
}
